Sorting mechanisms are utilized extensively in data processing systems for sorting records, such as, for example, ZIP codes, addresses, company name, last name of an individual, etc. Oftentimes the mechanisms are utilized to sort different groups of records at the same time. Sometimes the different groups of records each have their own record length, field offset and field length. There is a need to sort a plurality of groups of records when building multiple indices for the same table or database. As the number of records within a group get larger, the overall elapsed time to sort records within a group becomes longer. In addition, as the number of groups increases, and if those additional record lengths and/or sort field lengths of the records in the new groups are different than the record lengths and/or sort field lengths of the then existing groups, the elapsed time and the CPU time to sort is also increased. To further explain this problem in context of a data processing system refer to the following.
A typical data processing environment in which sorting will take place is, for example, in International Business Machine, Inc.'s MVS/ESA operating system mainframe environment utilizing multiple central processing units. A conventional process for sorting groups of records in such a data processing environment is a sequential process as will be described hereinbelow.
The normal solution is to add a common sort field to all the records, and sort all the records in one swipe. The added sort field is as long as the longest sort field padded with binary zeroes when needed.
Sorting groups of records in one swipe has the following disadvantages. First, since the sorting is accomplished in a sequential manner, as the number of groups to be sorted increases the elapsed time and the CPU time to sort these groups becomes greater. Accordingly, as the number of groups of records increases, the time to sort those groups of records also increases in a linear fashion. In addition, as the number of groups with different record lengths and/or sort field lengths increases, the total amount of data that has to be sorted is increased due to the padding or concatenation of additional data onto all records to be sorted. This also increases the elapsed time and the CPU time for sorting the groups of records.
Accordingly, what is needed is a system and method which decreases the elapsed time required to sort groups of records in a data processing system. The system and method should be easy to implement, cost effective and easily adaptable to existing data processing systems. The present invention addresses such a need.